<template>
    <div class="detail-gallay">
        <p class="title"><i class="iconfont icon-fanhui flt" @click="handleBack"></i>景区图片</p>
        <div class="list">
            <div class="item"
                 v-for="(item,i) in gallarys"
                 :style="{backgroundImage:'url('+item+')'}"
                 @click="handleShow(i)"
            ></div>
        </div>

        <detail-rotation
                v-if="isShow"
                :dt="gallarys"
                :idx="pageIndex"
                @close="handleClose"
        ></detail-rotation>

    </div>
</template>

<script>
    import DetailRotation from "./DetailRotation"
    export default {
        props: ['gallarys'],
        name: "DetailGallary",
        data() {
          return {
              isShow: false,
              pageIndex: 0
          }
        },
        methods: {
            handleBack() {
                this.$emit('hideGallary')
            },
            handleShow(i) {
                this.pageIndex = i
                this.isShow = true
            },
            handleClose() {
                this.isShow = false
            }
        },
        components: {
            DetailRotation
        }
    }
</script>

<style scoped>
    .detail-gallay {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        background: white;
        color: #222222;
        overflow: auto;
    }
    .title {
        position: fixed;
        width: 100%;
        line-height: 40px;
        border-bottom: 1px solid #eeeeee;
        font-size: 14px;
        text-align: center;
        background: white;
    }
    .title i {
        position: absolute;
        left: 0;
        top: 0;
        font-size: 25px;
    }
    .list {
        margin-top: 40px;
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
        box-sizing: border-box;
    }
    .list .item {
        width: calc((100% - 5px)*0.5);
        height: 120px;
        background-size: cover;
        margin-right: 5px;
        margin-bottom: 5px;
    }
    .item:nth-of-type(2n) {
        margin-right: 0;
    }
</style>